def findMax(matrix):
    max_value = float('-inf')
    max_coordinates = []
    
    for row_index,row in enumerate(matrix):
        for col_index,value in enumerate(row):
            if value >max_value:   
                max_value =value
                max_coordinates = [(row_index,col_index)]
            elif value == max_value:
                max_coordinates.append((row_index,col_index))
    return max_value,tuple(max_coordinates)
def main():
    n = eval(input())
    matrix = []
    for i in range(n):
        row = [ eval(x) for x in input().split() ]
        matrix.append(row)
    max_value, max_indexes = findMax(matrix)
    print(max_value)
    for item in max_indexes:
        print(item[0],item[1],sep=',')
    
if __name__ == "__main__":
    main()
# === DO NOT modify the code above ===